package com.woniu.car.config;

import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.stereotype.Component;

@Component
public class MyRedisTemplate extends RedisTemplate<String,Object> {
    public MyRedisTemplate(RedisConnectionFactory connectionFactory){
        this.setKeySerializer(RedisSerializer.string());
        this.setValueSerializer(RedisSerializer.json());
        this.setHashKeySerializer(RedisSerializer.string());
        this.setHashValueSerializer(RedisSerializer.json());
        this.setConnectionFactory(connectionFactory);
        this.afterPropertiesSet();

    }



}
